/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package processors;

import checker.checkerUser;

/**
 * Determines what to do when given the query Strings
 * @author Chris
 */
public class userProcessor {
    String _queryString;
    
    public userProcessor(String queryString) {
        _queryString = queryString;
    }
    
    public userProcessor() {
        _queryString = null;
    }
    
    public void setQuery(String queryString) {
        _queryString = queryString;
    }
    
    //Returns null on failure, since "" is an option
    public String processRequest() {
        if(_queryString == null) {
            return null;
        }
        
        checkerUser CU = new checkerUser();
        if(!CU.isValid(_queryString))
            return null;
        
        processor proc = ProcessorFactory.createProcessor(_queryString);
        
        try {
            return proc.process();
        }
        catch(Exception ex) {
            return null;
        }
    }
}
